import request from "./request";
import apiConfig from "./config";
import { getApiPath } from "./util";
export const userRegisterApi = function (data) {
  const {
    userRegister: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const establishmentRegistrationApi = function (data) {
  const {
    establishmentRegistration: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const buyerListApi = function (data) {
  const {
    buyerList: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const sellerListApi = function (data) {
  const {
    sellerList: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const buyerDelistingApi = function (data) {
  const {
    buyerDelisting: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const sellerDelistingApi = function (data) {
  const {
    sellerDelisting: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const buyerListingApi = function (data) {
  const {
    buyerListing: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const ownSellerApi = function (data) {
  const {
    ownSeller: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const ownBuyerApi = function (data) {
  const {
    ownBuyer: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const sellerListingApi = function (data) {
  const {
    sellerListing: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const ownBuyApi = function (data) {
  const {
    OwnBuyTransaction: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};

export const ownSellApi = function (data) {
  const {
    OwnSellTransaction: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};
export const depositApi = function (data) {
  const {
    deposit: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
  });
};
export const detailApi = function (data, params) {
  const {
    detail: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
    params,
  });
};

export const logoutApi = function (data, params) {
  const {
    logout: { path, method },
  } = apiConfig;
  return request({
    method,
    url: getApiPath(path),
    data,
    params,
  });
};
